package PowerWord.Core.Plan;

import PowerWord.Core.Data.WordList;

public class Group extends Duty {

	private int size = 200;
	private int day = 0;

	public Group(WordList l) {
		super(l);
	}
	
	@Override
	protected void GotoNext(){
		++day;
		day = Math.min(day, list.GetCount()/size + 1);
		CreateWork(0);
	}
	
	@Override
	protected void GotoPrev(){
		--day;
		day = Math.max(0, day);
		CreateWork(0);
	}
	
	protected void CreateWork(int flag){
		subList = new Integer[size];
		int base = day * size;
		for(int i=0; i<size; ++i){
			subList[i] = base + i;
		}
	}
	
	@Override
	protected void CreateWork(String arg0, String arg1, int flag) {
		size = Integer.valueOf(arg0);
		day = Integer.valueOf(arg1);
		CreateWork(flag);
	}
}
